

<template>

  <div id="jkgl1">

    <div>
      <el-link @click="$router.push({path:'/jkgl1'})" plain><h1>基础信息</h1></el-link><el-link @click="tz()" plain><h1>健康状况</h1></el-link>
    </div>

    <div class="aaa">
      <h3>
        基本信息
      </h3>
      名称:{{form.name}}<br><br>
      性别:{{form.sex}}<br><br>
      出生年月:{{form.date}}<br><br>
      籍贯:{{form.jg}}<br><br>
      <!--    证件类型:{{form.tx}}<br><br>-->
      证件号码:{{form.zjhm}}<br><br>
      民族:{{form.mz}}<br><br>
      联系电话:{{form.lxhm}}<br><br>
      爱好特长:{{form.tc}}<br><br>
      健康状况:{{form.status}}<br><br>
      通讯地址:{{form.dz}}<br><br>
      绑定设备:{{form.sid==1?"AAA":form.sid==2?"BBB":form.sid==3?"CCC":form.sid==4?"DDD":form.sid==5?"WWW":form.wid==6?"FFF":form.sid==7?"EEE":"TTT"}}-{{form.wid==1?"智能手表":form.wid==2?"头盔":form.wid==3?"视频设备":form.wid==4?"手机":form.wid==5?"手环":form.wid==6?"智能手套":form.wid==7?"智能玩具":"智能电脑"}}<br><br>
    </div>
    <div class="bbb">
      <span><h1>病人头像</h1></span>
      <img :src="form.photo" alt="" width="200px" height="200px">
      <span>  <h6>不能大于5M</h6> </span>
    </div>
     <div class="ccc">
       <h1>现病史</h1><br>
       <el-checkbox-group v-model="xbs">
         <el-checkbox-button label="高血压"></el-checkbox-button>
         <el-checkbox-button label="脑血管意外"></el-checkbox-button>
         <el-checkbox-button label="心肌梗死"></el-checkbox-button>
         <el-checkbox-button label="癫痫"></el-checkbox-button>
         <el-checkbox-button label="肺气肿"></el-checkbox-button>
         <el-checkbox-button label="慢性消化系统"></el-checkbox-button>
         <el-checkbox-button label="听力受损"></el-checkbox-button>
         <el-checkbox-button label="失聪"></el-checkbox-button>
       </el-checkbox-group>
    </div>
    <div class="ddd">
      <h1>过往病史</h1><br>
      <el-checkbox-group v-model="qbx">
        <el-checkbox-button label="高血压"></el-checkbox-button>
        <el-checkbox-button label="脑血管意外"></el-checkbox-button>
        <el-checkbox-button label="心肌梗死"></el-checkbox-button>
        <el-checkbox-button label="癫痫"></el-checkbox-button>
        <el-checkbox-button label="肺气肿"></el-checkbox-button>
        <el-checkbox-button label="慢性消化系统"></el-checkbox-button>
        <el-checkbox-button label="听力受损"></el-checkbox-button>
        <el-checkbox-button label="失聪"></el-checkbox-button>
      </el-checkbox-group>
    </div>
    <div >
      <h1>其他疾病</h1>
      <textarea v-model="form.qtjb" placeholder="请输入"></textarea>
    </div>
    <div id="app">
<h1>家属信息</h1>
      <el-table
          :data="tableData"
          border
          style="width: 100%">
        <el-table-column
            prop="id"
            label="遍号"
        >
        </el-table-column>

        <el-table-column
            prop="name"
            label="名称"
        >
        </el-table-column>

        <el-table-column
            prop="gid"
            label="关系"
        >
          <template slot-scope="scope">
            {{scope.row.gid=='1'?'父亲':scope.row.gid=='2'?'母亲':scope.row.gid=='3'?'儿子':scope.row.gid=='4'?'女儿':scope.row.gid=='5'?'兄弟':scope.row.gid=='6'?'姐妹':'其他'}}
          </template>
        </el-table-column>

        <el-table-column
            prop="dh"
            label="联系电话"
        >
        </el-table-column>

        <el-table-column
            prop="ddz"
            label="联系地址"
        >
        </el-table-column>

        <el-table-column
            prop="jjlx"
            label="紧急联系人"
        >
          <template slot-scope="scope">
            {{scope.row.jjlx==0?'否' :'是'}}
          </template>
        </el-table-column>



<!--        <el-table-column
            label="是否在用">
          <template slot-scope="scope">
            <el-button type="text" @click="del(scope.row.id)" size="mini">是</el-button>
          </template>
        </el-table-column>-->
      </el-table>
      <el-pagination
          @current-change="handleCurrentChange"
          @size-change="handleSizeChange"
          :current-page="pageNum"
          :page-sizes="[6, 12, 18, 24]"
          :page-size="pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total">
      </el-pagination>


    </div>




    <div>
      <el-button type="info" @click="$router.push({path:'/jkgl'})" plain>返回</el-button>
    </div>
  </div>
</template>

<style >
.aaa{
  width: 50%;

  float: left;
}
.bbb{
  width: 200px;
  height: 200px;
  float: right;
  margin-top: 10px;
}
.ccc{
width: 600px;
}
.ddd{
  width: 600px;
}


</style>

<script >


export default {


  data(){
    return{
      form:{},
      xbs: [],
      qbx: [],
      tableData:[],
      pageNum:1,
      pageSize:3,
      total:0,
      formInline:{},
      imageUrl:"",
      photo:""
    }
  },
  methods:{

    tz(){

      this.$router.push({path:'/jkgl3',query:{id:this.$route.query.id}})
    },
    beforeAvatarUpload(file) {
      const isJPG = file.type === 'image/jpeg';
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isJPG) {
        this.$message.error('上传头像图片只能是 JPG 格式!');
      }
      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!');
      }
      return isJPG && isLt2M;
    },

    handleAvatarSuccess(res, file) {
      this.imageUrl = URL.createObjectURL(file.raw);
      this.form.photo=res;
      // this.servicePackage.packageLogo=res;

    },

    findById(){
      var id = this.$route.query.id;//获取浏览器地址栏传递过来的id
            this.axios.get(`http://localhost:9010/fw/findById?id=${id}`).then(res=>{
              this.form=res.data.data;
              this.xbs=res.data.data.xbs.split(",");
              this.qbx=res.data.data.qbx.split(",");
      })
    },

    findPage1(){ //查询所有加分页参数
      this.axios.post(`http://localhost:9010/ffw/findPage1?pageNum=${this.pageNum}&pageSize=${this.pageSize}`,this.formInline).then(res=>{
        this.tableData=res.data.data.records;
        this.total=res.data.data.total;
        if (this.pageNum>res.data.data.pages){
          this.pageNum=res.data.data.pages;
          this.findPage();
        }
      })
    },
    handleCurrentChange(val) {//分页方法
      this.pageNum=val;
      this.findPage();
    },
    handleSizeChange(val) {
      this.pageSize = val;
      this.findPage();
    },


  },
  created(){
    this.findById();
    this.findPage1();
  }
}
</script>
